package com.dfrz.listener;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

@Component //让Spring管理我们的监听器
public class CSContextRefreshedEvent implements ApplicationListener<ContextRefreshedEvent> {
    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        System.out.println("监听器-刷新:可以通过event获得ApplicationContext 之后加入一些我们想要的逻辑");
        System.out.println("或者做一些其他的业务 比如初始化数据...");
    }
}
